$(document).ready(function(){
	$("#BEGIN_DATE").focus(function(){WdatePicker({dateFmt:'yyyy-MM-dd',oncleared:function(){$(this).blur();},onpicked:function(){$(this).blur();}})});
	$("#END_DATE").focus(function(){WdatePicker({dateFmt:'yyyy-MM-dd',oncleared:function(){$(this).blur();},onpicked:function(){$(this).blur();}})});
	cw.common.getUserSession(loadT_CHECK_INFO);
})

//载入资产盘点信息
function loadT_CHECK_INFO(){
	var CHECK_NO=$("#CHECK_NO").val();
	if(CHECK_NO==undefined)CHECK_NO="";
	var BEGIN_DATE=$("#BEGIN_DATE").val();
	if(BEGIN_DATE==undefined)BEGIN_DATE="";
	var END_DATE=$("#END_DATE").val();
	if(END_DATE==undefined)END_DATE="";
	var CHAGE_STATUS=$("#CHAGE_STATUS").val();
	var url = cw.common.path + '/json?action=QUERY_T_CHECK_INFOBY_PAGER_ACTION';
	url += "&CHECK_NO="+CHECK_NO+"&CHAGE_STATUS="+CHAGE_STATUS;
	url += "&BEGIN_DATE="+BEGIN_DATE+"&END_DATE="+END_DATE;
	var xmlname = "T_CHECK_INFO";
	var pagePanel='#T_CHECK_INFO_pager';
	var result='#T_CHECK_INFO_LIST';
	var pageSize=10;
	var defaultHtml='<li><em style="text-align: center;width:100%">没有搜索到您要查询的数据...</em></li>';
	cw.common.changePage(url,pageSize,xmlname,result,fn_queryloadT_CHECK_INFOLLIST,pagePanel,defaultHtml);
}
var fn_queryloadT_CHECK_INFOLLIST = function(obj,result,i){
	var status = obj.CHAGE_STATUS;
	if(status=='1')status="盘点中";
	else status="盘结";
	var str='<li id="bar_'+obj.CHECK_NO+'">';
	str+='<em style="width: 9%; text-align: center;">'+obj.CHECK_NO+'</em>';
	str+='<em style="width: 9%; text-align: center;">'+cw.common.toChar(obj.CHANGE_BEGIN_DATE,'yyyy-mm-dd')+'</em>';
	str+='<em style="width: 9%; text-align: center;">'+cw.common.toChar(obj.CHANGE_END_DATE,'yyyy-mm-dd')+'</em>';
	str+='<em style="width: 9%; text-align: center;">'+status+'</em>';
	str+='<em style="width: 9%; text-align: center;">'+obj.CHENG_BEFULLOF+'</em>';
	str+='<em style="width: 9%; text-align: center;">'+obj.CHENG_LOSE+'</em>';
	str+='<em style="width: 9%; text-align: center;">'+obj.BEFULLOF_LOSE+'</em>';
	str+='<em style="width: 9%; text-align: center;">'+obj.PERSON_NAME+'</em>';
	str+='<em style="width: 15%; text-align: center;">';
	str+='<a href="reportDetail.html?CHECKID='+obj.ID+'">明细</a>&nbsp;&nbsp;&nbsp;</em>';
	str+='</li>';
	$(result).append(str);
}

var download =function(id,status){
	
	if(status=='2'){
		alert("该盘点单已盘点，不能再下载盘点资产清单!");
	}
}
var upload =function(id,status){
	
	if(status=='2'){
		alert("该盘点单已盘点，不能再上载盘点资产清单!");
	}
	
	
}